package snowflake

import (
	"gin-skeleton/etc"
	"github.com/bwmarrin/snowflake"
	"github.com/sirupsen/logrus"
)

// Generate 生成雪花ID
func Generate() (snowflake.ID, error) {
	node, err := snowflake.NewNode(etc.Configure.App.NodeId)
	if err != nil {
		logrus.Error(err)
		return 0, err
	}

	return node.Generate(), nil
}
